package com.lc.yygh.task.service;

import com.lc.yygh.rabbit.MQConst;
import com.lc.yygh.rabbit.RabbitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling //@EnableScheduling 在配置类上使用，开启计划任务的支持
public class ScheduledTask {

    @Autowired
    private RabbitService rabbitService;

    /**
     * 每天8点执行 提醒就诊
     */
    //每天8点 0 0 8 * * ?
    @Scheduled(cron = "0 0 8 * * ? ")
    public void task1() {
        rabbitService.sendMessage(MQConst.EXCHANGE_DIRECT_TASK, MQConst.ROUTING_TASK_8, "");
    }
}
